package com.atguigu.spring5.textdemo.service;

import com.atguigu.spring5.textdemo.dao.UserDao;
import com.atguigu.spring5.textdemo.dao.UserDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserService {
   //根据类型注入
    //定义Dao类型属性
    //不需要添加Set方法
//   @Autowired
//   @Qualifier(value = "userDaoImpl")
//   private UserDao userDao;
    @Resource(name = "userDaoImpl")
   private UserDao userDao;
    @Value(value = "abc")
    private String name;
   public void add(){
       System.out.println("add..............."+name);
       userDao.add();
   }


}
